
function ajax(method, url, fn) {
    var ajax = new XMLHttpRequest();
    ajax.open(method, url, true)
    ajax.send()
    ajax.onreadystatechange = function () {
        if (this.readyState === 4) {
            if (this.status === 200) {
                fn(this.responseText)
            }
        }
    }
}
//GIS左侧数据导入
function leftNav() {
    ajax("get", "AJax/fishhad.json", function (e) {
        const arr = JSON.parse(e)
        let oul = document.querySelector('.left-content>ul')
        arr.forEach(function (item, index) {
            oul.insertAdjacentHTML('beforeEnd', `<li class="col-md-10 form-control li">
        <button class="btn btn-success qus">当前</button>
        <p class="xiqiao">${item.name}</p>
        <div class="xqtime"><b>任务开始时间：</b><span>${item.start}</span></div>
        <div class="xqtime"><b>任务结束时间：</b><span>${item.end}</span></div>
        <button class="btn btn-info ">采集区域</button>
        <button class="btn btn-info ">采集区域</button>
        <button class="btn btn-info ">采集区域</button>
        <button class="btn btn-info ">采集区域</button>
        <ul class="xqmessage">
            <li><b>图斑总数：</b><span>${item.num}</span></li>
            <li><b>已审核：</b><span>${item.finsh}</span></li>
            <li><b>已采集：</b><span>${item.over}</span></li>
            <li><b>未采集：</b><span>${item.nulls}</span></li>
        </ul>
  </li>`)
        })
    })
    ajax("get", "AJax/fishout.json", function (e) {
        const arr = JSON.parse(e)
        let oul = document.querySelector('.left-content .content')
        arr.forEach(function (item, index) {
            oul.insertAdjacentHTML('beforeEnd', `<li class="col-md-10 form-control li">
        <button class="btn btn-success qus">当前</button>
        <p class=" xiqiao">${item.name}</p>
        <div class="xqtime"><b>任务开始时间：</b><span>${item.start}</span></div>
        <div class="xqtime"><b>任务结束时间：</b><span>${item.end}</span></div>
        <button class="btn btn-info ">采集区域</button>
        <button class="btn btn-info ">采集区域</button>
        <button class="btn btn-info ">采集区域</button>
        <button class="btn btn-info ">采集区域</button>
        <ul class="xqmessage">
            <li><b>图斑总数：</b><span>${item.num}</span></li>
            <li><b>已审核：</b><span>${item.finsh}</span></li>
            <li><b>已采集：</b><span>${item.over}</span></li>
            <li><b>未采集：</b><span>${item.nulls}</span></li>
        </ul>
  </li>`)
        })
    })

}
leftNav()

